// 构造单例对象
export class GlobalContext {
  private constructor() {}
  private _objects = new Map<string,Object>();

  public static getContext(): GlobalContext {
    if(!globalThis.hRouterModule){
      globalThis.hRouterModule = {}
    }
    if (!globalThis.hRouterModule.GlobalContext) {
      globalThis.hRouterModule.GlobalContext = new GlobalContext();
    }
    return globalThis.hRouterModule.GlobalContext;
  }

  getObject(value: string):Object | undefined {
    return this._objects.get(value);
  }

  setObject(key: string, objectClass: Object | null): void {
    this._objects.set(key, objectClass);
  }

  removeObject(key:string):void{
    this._objects.delete(key)
  }


}